//
//  HMLeftMainCell.m
//  仿真开发
//
//  Created by B.HOPE on 2017/3/23.
//  Copyright © 2017年 B.HOPE. All rights reserved.
//

#import "HMLeftMainCell.h"
#import <Masonry.h>

@interface HMLeftMainCell ()

@property (nonatomic, strong) UIImageView *icon;

@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation HMLeftMainCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    self.backgroundColor = [UIColor colorWithRed:77/255.0 green:194/255.0 blue:156/255.0 alpha:1];
    
    _icon = [[UIImageView alloc] init];
    [self.contentView addSubview:_icon];
    _icon.image = [UIImage imageNamed:@"名医申请"];
    [_icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(10);
        make.left.offset(10);
        make.bottom.offset(-10);
        make.size.mas_offset(CGSizeMake(25, 25));
    }];
    
    _titleLabel = [[UILabel alloc] init];
    _titleLabel.text = @"名医申请";
    _titleLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_icon);
        make.left.equalTo(_icon.mas_right).offset(10);
    }];
}

- (void)setModel:(HMLeftMainModel *)model
{
    _model = model;
    
    _icon.image = [UIImage imageNamed:model.icon];
    _titleLabel.text = model.title;
}

@end
